//
//  BankDetailViewController.m
//  CarStore
//
//  Created by 千锋 on 16/2/16.
//  Copyright (c) 2016年 1000phone. All rights reserved.
//

#import "BankDetailViewController.h"
#import "BankCell.h"
#import "FooterCallCell.h"


@interface BankDetailViewController ()

@end

@implementation BankDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setUpSelf];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)setUpSelf
{
    self.tableView.estimatedRowHeight = 200;
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    
    self.tableView.showsVerticalScrollIndicator = NO;
    self.tableView.bounces = NO;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self.tableView registerNib:[UINib nibWithNibName:@"BankCell" bundle:nil] forCellReuseIdentifier:@"BankCellID"];
    [self.tableView registerNib:[UINib nibWithNibName:@"FooterCallCell" bundle:nil] forCellReuseIdentifier:@"FooterCallCellID"];
}


#pragma mark-TableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        BankCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BankCellID"];
        cell.detailLabel.text = self.detail;
        cell.titleLabel.text = self.detailTitle;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }else{
    FooterCallCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FooterCallCellID"];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 1) {
        NSString * str=[[NSString alloc] initWithFormat:@"telprompt://%@",@"01065957177"];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
    }
}


@end
